import { useRef } from "react";

function App() {
  const inputRef = useRef<HTMLInputElement>(null)
  const get = () => {
    console.log(inputRef.current?.value)

  }

  return (
    <>
      <input type="text" ref={inputRef} /><button onClick={get}>获取</button>
    </>
  );
}

export default App;
